<!doctype html>
<html lang=en dir=ltr class="no-js theme-united" xmlns:th="http://www.thymeleaf.org">
<div th:replace="admin/head::head(${title})"></div>

<style>
    thead tr th{
        text-align: center;
        vertical-align: middle;
    }
    tbody tr td{
        text-align: center;
        vertical-align: middle !important;
    }
</style>

<body class="page page-is-loading page-type-page page-type-home">
    <div th:replace="admin/head::navbar"></div>

    <div class="container-fluid main-container">
        <div class=row>
            <div class=col-md-12>
                <h1 class="page-title">文章管理</h1>
            </div>
        </div>
        <div class="row">
            <table class="table table-bordered table-hover" style="table-layout: auto;">
                <thead>
                    <tr style="font-size: 16px;">
                        <th>文章标题</th>
                        <th>发布时间</th>
                        <th>浏览量</th>
                        <th>标签</th>
                        <th>状态</th>
                        <th>类型</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody style="font-size: 12px;">
                    <tr th:each="article : ${pageInfo.getList()}">
                        <td style="width: 35%" th:text="${article.title}"></td>
                        <td style="width: 15%" th:text="${commonUtils.fmtdate(article.createTime)}"></td>
                        <td style="width: 5%" th:text="${article.views}"></td>
                        <td style="width: 15%" th:text="${article.tags}"></td>

                        <td style="width: 5%;">
                            <th:block th:if="${article.status eq 0}">
                                <span style="color: #ffc402;">草稿</span>
                            </th:block>
                            <th:block th:if="${article.status eq 1}">
                                <span style="color: #00d95a;">公开</span>
                            </th:block>
                            <th:block th:if="${article.status eq 2}">
                                <span style="color: #0000C0;">私密</span>
                            </th:block>
                        </td>

                        <td style="width: 5%;">
                            <th:block th:if="${article.type eq 0}">
                                <span style="color: orangered;">原创</span>
                            </th:block>
                            <th:block th:if="${article.type eq 1}">
                                <span style="color: greenyellow;">转载</span>
                            </th:block>
                            <th:block th:if="${article.type eq 2}">
                                <span style="color: deepskyblue;">翻译</span>
                            </th:block>
                        </td>

                        <td style="width: 15.5%">
                            <a th:href="@{'/post/' + ${article.id}}" target="_blank"><button class="btn btn-info">查看</button></a>
                            <a th:href="@{'/admin/article/modify/'+${article.id}}" target="_self"><button class="btn btn-warning">编辑</button></a>
                            <a href="javascript:;" th:onclick="'delete_article('+${article.id}+')'"><button class="btn btn-danger">删除</button></a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

        <div th:replace="common/page::pagination(${pageInfo}, ${link})"></div>

    </div>

    <div th:replace="admin/footer::footer"></div>
</body>
</html>